package module_five.task03test;

import module_five.task03.ServerInitClose;
import module_five.task03.ServerView;
import module_five.task03.serverModel.ServerDao;
import module_five.task03.serverModel.ServerStudentManager;

import java.io.IOException;

public class ServerTest {

    public static void main(String[] args) {

        ServerInitClose sic = null;
        try {
            sic = new ServerInitClose();

            sic.serverInit();

            ServerDao sd = new ServerDao();
            ServerStudentManager ssm = new ServerStudentManager();
            ServerView sv = new ServerView(sic, sd, ssm);
            while (true) {
                sv.serverReceive();
            }

        } catch (IOException | ClassNotFoundException e) {
            e.printStackTrace();
        } finally {
            if (null != sic) {
                try {
                    sic.serverClose();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
